void main(List<String> args) {
  String str = 'hello world';
  Map<String, int> charCount = {};
  for (int i = 0; i < str.length; i++) {
    String char = str[i];
    if (charCount.containsKey(char)) {
      charCount[char] = charCount[char]! + 1;
    } else {
      charCount[char] = 1;
    }
  }
}
